package com.himalayan.bear.controller;

import com.himalayan.bear.entity.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;

import javax.servlet.http.HttpSession;

@PropertySource({"classpath:config.properties"})
public class BaseController {

    @Value("${valid.code}")
    protected String validCode;

    protected User getUser(HttpSession session) {
        Object user = session.getAttribute("currentUser");
        if (user == null) {
            return null;
        }
        return (User) user;
    }
}
